﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

using Sfs2X.Entities;

/// <summary>
/// base user class.
/// </summary>
public abstract class wsBaseUser
{
	/// <summary>
	/// smartfox user info.
	/// </summary>
	public Sfs2X.Entities.User userInfo;
}

/// <summary>
/// Smartfox User Manager
/// </summary>
[AddComponentMenu("wsLibrary/Network/Smartfox User Manager")]
public class wsSmartfoxUserManager : MonoBehaviour
{
	#region Singleton Pattern
	/**********************************
	 * singleton
	 * *******************************/
	/// <summary>
	/// Get Singleton Instance.
	/// </summary>
	public static wsSmartfoxUserManager Instance
	{
		get
		{
			return wsSingletonObject<wsSmartfoxUserManager>.Instance;
		}
	}

	/// <summary>
	/// Awake this instance.
	/// </summary>
	void Awake()
	{
		wsSingletonObject<wsSmartfoxUserManager>.Awake(gameObject);
	}
	#endregion

	private List<wsBaseUser> userList = new List<wsBaseUser>();
	private wsBaseUser player = null;

	/// <summary>
	/// Get User List.
	/// </summary>
	public List<wsBaseUser> UserList { get { return userList; } }

	/// <summary>
	/// Add User.
	/// </summary>
	/// <param name="user"></param>
	public void AddUser(wsBaseUser user)
	{
		userList.Add(user);
	}

	/// <summary>
	/// Get user.
	/// </summary>
	/// <param name="idx"></param>
	/// <returns></returns>
	public wsBaseUser GetUser(int idx)
	{
		return userList[idx];
	}

	/// <summary>
	/// Set Player.
	/// </summary>
	/// <param name="user"></param>
	public void SetPlayer(wsBaseUser user)
	{
		this.player = user;
	}

	/// <summary>
	/// Get Player.
	/// </summary>
	/// <returns></returns>
	public wsBaseUser GetPlayer()
	{
		return player;
	}
}
